// 柯里化案例

// ''.match(/\s+/g)
// ''.match(/\d+/g)

const _ = require('lodash')

// function match (reg, str) {
//     return str.match(reg)
// }

const match = _.curry((reg, str) => str.match(reg))

const haveSpace = match(/\s+/g)
const haveNumber = match(/\d+/g)

// console.log(haveSpace('helloworld'))
// console.log(haveNumber('111111111hellow333orld2222'))



const filter = _.curry((func, array) => array.filter(func))
console.log(filter(haveSpace, ['John Connor', 'John_Donne']))


const findSpace = filter(haveSpace)
console.log(findSpace(['John Connor', 'John_Donne']))

